import request from '@/utils/request';
import { getUserInfo, getApplicationId } from "@/utils/auth";

export function loginByUsername(username, password) {
  return request({
    url: process.env.VUE_APP_SYS_SERVICE + 'account/login',
    method: 'post',
    data: {
      userName: username,
      password: password
    },
    showLoading: true // 提示作用，以后默认为true
  });
}

export function getLeftMenus() {
  return request({
    url: process.env.VUE_APP_SYS_SERVICE + 'api/sysMenu/getUserMenuTree',
    method: 'get',
    params: {
      userId: getUserInfo().userId,
      applicationId: getApplicationId(),
      isShow: 1
    }
  });
}

export function getTopMenus() {
  return request({
    url: process.env.VUE_APP_SYS_SERVICE + 'api/sysApplication/getSysApplicationListByPage',
    method: 'post',
    data: {}
  });
}
